#!/bin/sh

# Script to generate database passwords for secon db. Passwords will be written to stdout,
# you can redirect stdout to etc/dbpasswords_db2.secret

# Exit on any error:
set -e

echo "# Format: '<role>:<db_host>:<db_name>:<user>:<password>'"
for group in teamz juryz publicz pluginz; do
	printf "$group:localhost:domjudge2:domjudge_$group:"
	head -c12 /dev/urandom | uuencode -m /dev/stdout | tail -n +2 | \
		head -c16 | tr '/+' 'Aa'
	echo
done
